<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        //类的声明
        class A{
            //属性   为『实例对象』设置属性
            //设置固定属性, 可以使用这种方式
            age = 20;
            fn = function(){
                console.log('fn fn fn');
            }

            fn2 = () => {
                console.log('fn2 fn2 fn2')
            }

            //构造方法
            constructor(name){
                //为实例对象设置属性, 设置变化的属性值的时候, 建议使用 this. 
                this.name = name;
                this.age = 20;
            }

            //该方法是保存在『原型对象上的』
            fn(){
                console.log('fn fn fn');
            }
        }



        
        let obj = new A('王五');
        let obj2 = new A('赵六');
        // obj.name = '张三';

        console.log(obj);
        console.log(obj2);


    </script>
</body>
</html>